//
//  ViolationInfoController.swift
//  TrafficViolation
//
//  Created by eaglelive on 2017/5/5.
//  Copyright © 2017年 eaglelive. All rights reserved.
//

import Foundation
import UIKit
//单条违章基本信息
class ViolationInfoController: BaseController {
    var violation:ViolationModel!
    var infoTable:UITableView!//数据表格
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        setupNavBar(title: violation.carNum, isback: true, appearWay: 3, isright: false)//自定义导航
        //初始化表格
        infoTable = UITableView(frame: CGRect(x:0,y:kStatusBarH + kNavigationBarH + 40,width:kScreenW,height:kScreenH),style: UITableViewStyle.plain)
        infoTable?.delegate = self
        infoTable?.dataSource = self
        infoTable?.backgroundColor = tableBgColor
        infoTable?.separatorStyle = UITableViewCellSeparatorStyle.none
        infoTable?.rowHeight = 275
        self.view.addSubview(infoTable!)
        infoTable?.snp.makeConstraints({ (make) in
            make.left.right.equalTo(self.view)
            make.top.equalTo(self.view).offset(kStatusBarH + kNavigationBarH)
            make.bottom.equalTo(self.view)
        })
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
extension ViolationInfoController:UITableViewDelegate, UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        var cell: ViolationInfoCell? = tableView.dequeueReusableCell(withIdentifier: "infoCell") as? ViolationInfoCell
        if cell == nil {
            cell = ViolationInfoCell(style: UITableViewCellStyle.default,reuseIdentifier: "infoCell")
        }
        cell?.configCellDateWithModel(model:violation)
        
        return cell!
    }
}

